//
//  BHChoseAddressSearchView.swift
//  BigHealth
//
//  Created by 蔺百好 on 2021/6/25.
//

import UIKit

class BHChoseAddressSearchView: UIView {
    
    var begainSearchEdite:(() -> Void)?
    

    @IBOutlet weak var cityBtn: UIButton!
    @IBOutlet weak var searchBackView: UIView!
    
    @IBOutlet weak var searchTextFiled: UITextField!
    
    static func loadFromXib() -> BHChoseAddressSearchView {
        let viewArray = Bundle.main.loadNibNamed("BHChoseAddressSearchView", owner: nil, options: nil)
        let view: BHChoseAddressSearchView = viewArray![0] as! BHChoseAddressSearchView
        return view
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        self.searchBackView.addLayerCorner(16, 0, .white)
        self.searchTextFiled.delegate = self
    }
}


extension BHChoseAddressSearchView: UITextFieldDelegate {
    func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
        self.begainSearchEdite?()
        return true
    }
}


class BHChoseAddressBottomView: UIView {
    
    @IBOutlet weak var builldingName_label: UILabel!
    
    @IBOutlet weak var address_label: UILabel!
    
    @IBOutlet weak var confirmBtn: UIButton!
    
    static func loadFromXib() -> BHChoseAddressBottomView {
        let viewArray = Bundle.main.loadNibNamed("BHChoseAddressSearchView", owner: nil, options: nil)
        let view: BHChoseAddressBottomView = viewArray![1] as! BHChoseAddressBottomView
        return view
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        self.confirmBtn.addLayerCorner(25, 0, .white)
        
    }
    
    static var height: CGFloat {
        return 160+UIScreen.safeBottomHeight
    }
}
